<%@ page import="java.sql.*" %>
<%@page import="shopping.ConnectionUtil"  %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
    <title>登陆检测</title>
</head>
<body>
<%
    String user = request.getParameter("user");
    String pass = request.getParameter("password");

    Connection con=ConnectionUtil.getConnection();
    String sql="select * from hj where user=? and pass=?";
    PreparedStatement stmt=con.prepareStatement(sql);
    stmt.setString(1, user);
    stmt.setString(2, pass);
    ResultSet rs=stmt.executeQuery();
    out.println("<script>");
    
   
	if(rs.next()){
	out.println("alert('登录成功！')");
	out.println("window.location ='/shopping/Zjm2.jsp';");
	session.setAttribute("user", user);
   /*  Object count=application.getAttribute("count");
	if(count == null){
	count=0;
	}else{
	Integer c =(Integer)count;
	c +=1;
	application.setAttribute("count", c);
	} */
	
	
    }else{
    out.println("alert('登录失败！')");
    out.println("window.location ='/shopping/Dl.jsp';");
    }
    out.println("</script>");
%>
</body>
</html>